<?php use_helper('I18N') ?>

<?php echo form_tag('user/sitelist', Array('id' => 'master', 'name' => 'master')) ?>

<table width="950">
	<tr>
    	<td valign="top">
        	<table width="100%">
            	<tr>
                	<td width="164"><img src="/images/bto_logo.jpg" /></td>
                    <td width="16">&nbsp;</td>
                    <td align="left" class="welcome">&nbsp;&nbsp;WELCOME ADMIN</td>
                    <td width="70" align="right" valign="bottom"><img name="btnLogout" id="btnLogout" onmouseover="roll_over('btnLogout', '/images/logout_btnAF.jpg')" onmouseout="roll_over('btnLogout', '/images/logout_btn.jpg')" src="/images/logout_btn.jpg" border="0" onClick="location.href='/user/logout'" /></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
    	<td height="20">&nbsp;</td>
    </tr>
    <tr style="display:none">
    	<td align="right">
    	<input name="upload_site" id="upload_site" type="file" onkeypress="return false" />
    	<input type="submit" value="Import Site" name="btnImport" id="btnImport">
    	</td>
    </tr>
    <tr>
    	<td align="right"><a href='/user/editsite?height=260&width=440' rel='sexylightbox'><img name="btnNew" id="btnNew" onmouseover="roll_over('btnNew', '/images/create_new_site_btnAF.jpg')" onmouseout="roll_over('btnNew', '/images/create_new_site_btn.jpg')" src="/images/create_new_site_btn.jpg" border="0" /></a></td>
    </tr>
    <tr>
    	<td>
        	<table width="100%">
            	<tr>
			    	<td align="left" width='50%'></td>
                    <td align="right">
                    	<?php echo select_tag('cbo_search', options_for_select(array('0'=>'Search By', '1'=>'Site No', '2' => 'Location', '3' => 'Display Size'), $cbo_search)); ?>
                    </td>
                    <td align="right">
                    	<?php echo input_tag('txt_search', $txt_search) ?>
                    	<?php echo input_hidden_tag('page', $pager->getPage()) ?>
                    </td>
                    <td align="right">
                    	<?php echo select_tag('cbo_order', options_for_select(array('asc'=>'Ascending', 'desc'=>'Descending'), $cbo_order)); ?>
                    </td>
                    <td align="right">
                    	<table cellpadding="0" cellspacing="0"><tr>
                    	<td><input type="submit" value="" class="search" name="btnSearch" id="btnSearch" onmouseover="change_class('btnSearch', 'searchAF')" onmouseout="change_class('btnSearch', 'search')"></td>
                    	<td><img name="btnBack" id="btnBack" onmouseover="roll_over('btnBack', '/images/back_btnAF.jpg')" onmouseout="roll_over('btnBack', '/images/back_btn.jpg')" src="/images/back_btn.jpg" border="0" onClick="location.href='/user/sitelist'" /></td>
                    	</tr></table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
    	<td>
        	<table class="admin" width="100%" cellpadding="0" cellspacing="0">
            	<tr>
                	<td align="left" class="adminTitle" height="40">&nbsp;Site Listing</td>
                </tr>
                <?php
					$color = "#cfecdb";
					
					echo '<tr><td bgcolor="#ffffff">';
						echo '<table width="100%"><tr>';
                        echo '<td width="120" align="left">Site No.</td>';
                        echo '<td align="left">Location</td>';
                        echo '<td width="120" align="right">Display Size</td>';
                        echo '<td width="66" align="right" valign="middle"></td>';
                        echo '</tr></table>';
                       	echo '</td></tr>';
					
					foreach ($pager->getResults() as $tbl_site){
						echo '<tr><td bgcolor="'.$color.'">';
						echo '<table width="100%"><tr>';
                        echo '<td width="120" align="left">'.$tbl_site->getFSiteNo().'</td>';
                        echo '<td align="left">'.$tbl_site->getFSiteLocation().'</td>';
                        echo '<td width="120" align="right">'.$tbl_site->getFDisplaySize().'</td>';
                        echo '<td width="66" align="right" valign="middle"><img src="/images/icon_edit.png" />&nbsp;<a href="/user/editsite?f_id='.$tbl_site->getFId().'&height=260&width=440" rel="sexylightbox" class="login">edit</a></td>';
                        echo '</tr></table>';
                       	echo '</td></tr>';
                            	
                      	if($color=="#cfecdb")
                      		$color="#ffffff";
                       	else
                       		$color = "#cfecdb";
					}
				?>
            </table>
        </td>
    </tr>
    <tr>
    	<td height="20" align="right">
    	<?php
			if ($pager->haveToPaginate()){
				echo "<table><tr>";
				echo '<td width="20" align="center" class="page_no_underline">'.link_to("<", '/user/sitelist?page='.$pager->getPreviousPage().$condition, array('class' => 'create_no_line')).'</td>';
				$links = $pager->getLinks(); 
				$count = 1;
				foreach ($links as $page){
					echo ($page == $pager->getPage()) ? '<td width="20" align="center" class="page_selected">'.str_pad($page, 2, "0", STR_PAD_LEFT).'</td>' : '<td width="20" align="center" class="page">'.link_to(str_pad($page, 2, "0", STR_PAD_LEFT), '/user/sitelist?page='.$page.$condition, array('class' => 'create_no_line')).'</td>';
					if($count==5) break;
					else $count++;
				}
				echo '<td width="20" align="center" class="page_no_underline">'.link_to(">", '/user/sitelist?page='.$pager->getNextPage().$condition, array('class' => 'create_no_line')).'</td>';
				echo "</tr></table>";
			}
		?>
    	</td>
    </tr>    
</table>

</form>
